const path = require('path')
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer')
const pkg = require('./package.json')

let libraryName = pkg.name

module.exports = {
  entry: './src/index.js',
  devtool: 'inline-source-map',
  devServer: {
    contentBase: './test/test_page'
  },
  output: {
    path: path.resolve(__dirname, 'lib'),
    filename: 'index.js',
    library: libraryName,
    libraryTarget: 'umd',
    umdNamedDefine: true,
    globalObject: "typeof self !== 'undefined' ? self : this"
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /(node_modules)/,
        loader: 'babel-loader'
      }
    ]
  },
  node: {
    fs:'empty'
  },
  plugins: [new BundleAnalyzerPlugin()]
}